@if(Session::has('errors'))
<div id="panel-error" class="row">
	<div class="col-md-12">
		<div class="panel panel-red panel-minimal">
			<header class="panel-heading">{{trans('form.error')}}</header>
			<div class="panel-body">
				@foreach($errors as $error)
					{{$error['message']}} <br />
				@endforeach
			</div>
		</div>
	</div>
</div>
@endif

<div class='row'>
	<div class='col-md-12'>
		<div class="panel panel-default">
			<!--<header class="panel-heading">{{ trans('usergroup.create') }}</header>-->
			<div class="panel-body">
				{{Form::open(array('method' => 'post', 'class' => 'form-horizontal', 'url' => 'admin/user-group/save'))}}
					<div class="form-group">
						{{Form::label('group', trans('usergroup.name'), array('class' => 'col-sm-2 control-label'))}}
						<div class="col-sm-5">
							{{Form::text('group', (isset($usergroup->group))? $usergroup->group : null, array('class' => 'form-control', 'id' => 'group', 'placeholder' => trans('usergroup.name')))}}
						</div>
					</div>

					<div class="form-group">
						{{Form::label('description', trans('usergroup.description'), array('class' => 'col-sm-2 control-label'))}}
						<div class="col-sm-5">
							{{Form::text('description', (isset($usergroup->description))? $usergroup->description : null, array('class' => 'form-control', 'id' => 'description', 'placeholder' => trans('usergroup.description')))}}
						</div>
					</div>

					<div class="form-group">
						<div class="col-sm-2"></div>
						<div class="col-sm-5">
							{{Form::submit(trans('form.save'), array('class' => 'btn btn-primary btn-lg'))}}
							{{Form::button(trans('form.cancel'), array('class' => 'btn btn-default btn-lg', 'id' => 'cancel'))}}
						</div>
					</div>

					{{Form::hidden('id', (isset($usergroup->id))? $usergroup->id : 0, array('id' => 'id'))}}
					{{Form::hidden('type', 'usergroup', array('id' => 'type'))}}
				{{Form::close()}}
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
	$("button#cancel").click(function(event) {
		/* Act on the event */
		var url = '{{URL::to('admin/user-group/')}}';

		window.location = url;
	});
});
</script>